// var i;
// var $eventManager = require("./EventManager");
// var $resKeeper = require("./ResKeeper");
// var $evenType = require("./EvenType");
// var $playerDataManager = require("./PlayerDataManager");
// var $excel = require("./Excel");
// var $gameDataManager = require("./GameDataManager");
// var $hallGlobalVariable = require("./HallGlobalVariable");
// var f = cc._decorator;
// var g = f.ccclass;
// var _ = f.property;
// var y = f.inspector;
// var m = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t.typeadd = 0;
//         t.togglebeilv1 = null;
//         t.togglebeilv2 = null;
//         t.jiabeicode = 1;
//         return t;
//     }
//     __extends(t, e);
//     t.prototype.onEnable = function () {
//         this.jiabeicode = 1;
//         if (this.togglebeilv1 && this.togglebeilv2) {
//             this.togglebeilv1.isChecked = !1;
//             this.togglebeilv2.isChecked = !1;
//         }
//     };
//     t.prototype.addHuoBi = function () {
//         switch (this.typeadd) {
//             case 1:
//                 $playerDataManager.PlayerDataMgr.AddDiamond(100 * this.jiabeicode);
//                 break;
//             case 2:
//                 $playerDataManager.PlayerDataMgr.AddPower(100 * this.jiabeicode);
//                 break;
//             case 3:
//                 $playerDataManager.PlayerDataMgr.AddGold(100 * this.jiabeicode);
//                 break;
//             case 4:
//                 $hallGlobalVariable.default.GetSuiPian([100 * this.jiabeicode, 0, 0]).forEach(function (e, t) {
//                     $playerDataManager.PlayerDataMgr.AddEquipFragments(t, e);
//                 });
//                 break;
//             case 5:
//                 $hallGlobalVariable.default.GetSuiPian([0, 100 * this.jiabeicode, 0]).forEach(function (e, t) {
//                     $playerDataManager.PlayerDataMgr.AddEquipFragments(t, e);
//                 });
//                 break;
//             case 6:
//                 $hallGlobalVariable.default.GetSuiPian([0, 0, 100 * this.jiabeicode]).forEach(function (e, t) {
//                     $playerDataManager.PlayerDataMgr.AddEquipFragments(t, e);
//                 });
//                 break;
//             case 7:
//                 var e = $gameDataManager.GameDataMgr.getNowMaxLevel();
//                 e += 1;
//                 var t = $excel.Excel.shuiguoguanqia(e + 1).levelboshuid.length;
//                 $gameDataManager.GameDataMgr.updateLevelBoShu(e, t, 2);
//                 $hallGlobalVariable.default.isNeedResetWareHouse = !0;
//                 $eventManager.EventMgr.dispatchEvent($evenType.EVENT_TYPE.HallResetUnLockFurit);
//                 $eventManager.EventMgr.dispatchEvent($evenType.EVENT_TYPE.HallResetBag);
//                 break;
//             case 8:
//                 var o = $excel.Excel.shuiguotiaozhan(1).levelboshuid.length;
//                 $gameDataManager.GameDataMgr.updateLevelBoShu(1, o, 1);
//                 break;
//             case 9:
//                 $playerDataManager.PlayerDataMgr.resetWuJinCount(!0);
//         }
//     };
//     t.prototype.onClickTen = function () {
//         if (10 == this.jiabeicode) {
//             this.jiabeicode = 1;
//             this.togglebeilv1.isChecked = !1;
//         } else {
//             this.jiabeicode = 10;
//             this.togglebeilv2.isChecked = !1;
//             this.togglebeilv1.isChecked = !0;
//         }
//     };
//     t.prototype.onClickTen100 = function () {
//         if (100 == this.jiabeicode) {
//             this.jiabeicode = 1;
//             this.togglebeilv2.isChecked = !1;
//         } else {
//             this.jiabeicode = 100;
//             this.togglebeilv1.isChecked = !1;
//             this.togglebeilv2.isChecked = !0;
//         }
//     };
//     __decorate([_()], t.prototype, "typeadd", void 0);
//     __decorate([_(cc.Toggle)], t.prototype, "togglebeilv1", void 0);
//     __decorate([_(cc.Toggle)], t.prototype, "togglebeilv2", void 0);
//     return __decorate([g], t);
// })($resKeeper.default);
// exports.default = m;

// import { EventMgrInstance } from "./EventManager";
// import ResKeeper from "./ResKeeper";
// import { EVENT_TYPE } from "./EvenType";
// import { PlayerDataMgr } from "./PlayerDataManager";
// import { Excel } from "./Excel";
// import { GameDataMgr } from "./GameDataManager";
// import HallGlobalVariable from "./HallGlobalVariable";

// const { ccclass, property, inspector } = cc._decorator;

// /**
//  * 建议类名: CurrencyManager
//  * 货币管理类，负责处理货币的增加和相关操作
//  */
// @ccclass
// class CurrencyManager extends ResKeeper {
//     @property
//     typeadd: number = 0;

//     @property(cc.Toggle)
//     togglebeilv1: cc.Toggle | null = null;

//     @property(cc.Toggle)
//     togglebeilv2: cc.Toggle | null = null;

//     jiabeicode: number = 1;

//     /**
//      * 建议方法名: handleOnEnable
//      * 当组件启用时重置加倍码和切换状态
//      */
//     onEnable(): void {
//         this.jiabeicode = 1;
//         if (this.togglebeilv1 && this.togglebeilv2) {
//             this.togglebeilv1.isChecked = false;
//             this.togglebeilv2.isChecked = false;
//         }
//     }

//     /**
//      * 建议方法名: handleAddCurrency
//      * 根据typeadd的值增加不同类型的货币
//      */
//     addHuoBi(): void {
//         switch (this.typeadd) {
//             case 1:
//                 PlayerDataMgr.AddDiamond(100 * this.jiabeicode);
//                 break;
//             case 2:
//                 PlayerDataMgr.AddPower(100 * this.jiabeicode);
//                 break;
//             case 3:
//                 PlayerDataMgr.AddGold(100 * this.jiabeicode);
//                 break;
//             case 4:
//                 HallGlobalVariable.GetSuiPian([100 * this.jiabeicode, 0, 0]).forEach((value, index) => {
//                     PlayerDataMgr.AddEquipFragments(index, value);
//                 });
//                 break;
//             case 5:
//                 HallGlobalVariable.GetSuiPian([0, 100 * this.jiabeicode, 0]).forEach((value, index) => {
//                     PlayerDataMgr.AddEquipFragments(index, value);
//                 });
//                 break;
//             case 6:
//                 HallGlobalVariable.GetSuiPian([0, 0, 100 * this.jiabeicode]).forEach((value, index) => {
//                     PlayerDataMgr.AddEquipFragments(index, value);
//                 });
//                 break;
//             case 7:
//                 let currentLevel = GameDataMgr.getNowMaxLevel();
//                 currentLevel += 1;
//                 const bossCount = Excel.shuiguoguanqia(currentLevel + 1).levelboshuid.length;
//                 GameDataMgr.updateLevelBoShu(currentLevel, bossCount, 2);
//                 HallGlobalVariable.isNeedResetWareHouse = true;
//                 EventMgrInstance.dispatchEvent(EVENT_TYPE.HallResetUnLockFurit);
//                 EventMgrInstance.dispatchEvent(EVENT_TYPE.HallResetBag);
//                 break;
//             case 8:
//                 const challengeBossCount = Excel.shuiguotiaozhan(1).levelboshuid.length;
//                 GameDataMgr.updateLevelBoShu(1, challengeBossCount, 1);
//                 break;
//             case 9:
//                 PlayerDataMgr.resetWuJinCount(true);
//                 break;
//         }
//     }

//     /**
//      * 建议方法名: handleClickTen
//      * 处理点击10倍按钮的逻辑
//      */
//     onClickTen(): void {
//         if (this.jiabeicode === 10) {
//             this.jiabeicode = 1;
//             if (this.togglebeilv1) this.togglebeilv1.isChecked = false;
//         } else {
//             this.jiabeicode = 10;
//             if (this.togglebeilv2) this.togglebeilv2.isChecked = false;
//             if (this.togglebeilv1) this.togglebeilv1.isChecked = true;
//         }
//     }

//     /**
//      * 建议方法名: handleClickHundred
//      * 处理点击100倍按钮的逻辑
//      */
//     onClickTen100(): void {
//         if (this.jiabeicode === 100) {
//             this.jiabeicode = 1;
//             if (this.togglebeilv2) this.togglebeilv2.isChecked = false;
//         } else {
//             this.jiabeicode = 100;
//             if (this.togglebeilv1) this.togglebeilv1.isChecked = false;
//             if (this.togglebeilv2) this.togglebeilv2.isChecked = true;
//         }
//     }
// }

// export default CurrencyManager;

import { EventMgrInstance } from "./EventManager";
import ResKeeper from "./ResKeeper";
import { EVENT_TYPE } from "./EvenType";
import { PlayerDataMgr } from "./PlayerDataManager";
import { Excel } from "./Excel";
import { GameDataMgr } from "./GameDataManager";
import FruitDataManager from "./HallGlobalVariable";

const { ccclass, property, inspector } = cc._decorator;

/**
 * 建议类名: CurrencyManager
 * 货币管理类，负责处理货币的增加和相关操作
 */
@ccclass
class ViewDebugItem extends ResKeeper {
    @property
    typeadd: number = 0;

    @property(cc.Toggle)
    togglebeilv1: cc.Toggle | null = null;

    @property(cc.Toggle)
    togglebeilv2: cc.Toggle | null = null;

    jiabeicode: number = 1;

    /**
     * 建议方法名: handleOnEnable
     * 当组件启用时重置加倍码和切换状态
     */
    onEnable(): void {
        this.jiabeicode = 1;
        if (this.togglebeilv1 && this.togglebeilv2) {
            this.togglebeilv1.isChecked = false;
            this.togglebeilv2.isChecked = false;
        }
    }

    /**
     * 建议方法名: handleAddCurrency
     * 根据typeadd的值增加不同类型的货币
     */
    addHuoBi(): void {
        switch (this.typeadd) {
            case 1:
                PlayerDataMgr.addDiamond(100 * this.jiabeicode);
                break;
            case 2:
                PlayerDataMgr.addPower(100 * this.jiabeicode);
                break;
            case 3:
                PlayerDataMgr.addGold(100 * this.jiabeicode);
                break;
            case 4:
                this.addEquipFragments([100 * this.jiabeicode, 0, 0]);
                break;
            case 5:
                this.addEquipFragments([0, 100 * this.jiabeicode, 0]);
                break;
            case 6:
                this.addEquipFragments([0, 0, 100 * this.jiabeicode]);
                break;
            case 7:
                this.handleMaxLevelUpdate();
                break;
            case 8:
                this.handleChallengeUpdate();
                break;
            case 9:
                PlayerDataMgr.resetWuJinCount(true);
                break;
        }
    }

    /**
     * 建议方法名: handleClickTen
     * 处理点击10倍按钮的逻辑
     */
    onClickTen(): void {
        if (this.jiabeicode === 10) {
            this.jiabeicode = 1;
            if (this.togglebeilv1) this.togglebeilv1.isChecked = false;
        } else {
            this.jiabeicode = 10;
            if (this.togglebeilv2) this.togglebeilv2.isChecked = false;
            if (this.togglebeilv1) this.togglebeilv1.isChecked = true;
        }
    }

    /**
     * 建议方法名: handleClickHundred
     * 处理点击100倍按钮的逻辑
     */
    onClickTen100(): void {
        if (this.jiabeicode === 100) {
            this.jiabeicode = 1;
            if (this.togglebeilv2) this.togglebeilv2.isChecked = false;
        } else {
            this.jiabeicode = 100;
            if (this.togglebeilv1) this.togglebeilv1.isChecked = false;
            if (this.togglebeilv2) this.togglebeilv2.isChecked = true;
        }
    }

    /**
     * 添加装备碎片
     * @param fragments  碎片数组
     */
    private addEquipFragments(fragments: number[]): void {
        FruitDataManager.getSuiPian(fragments).forEach((fragment, index) => {
            PlayerDataMgr.addEquipFragments(index, fragment);
        });
    }

    /**
     * 更新最大级别的逻辑处理
     */
    private handleMaxLevelUpdate(): void {
        let currentLevel = GameDataMgr.getCurrentMaxLevel();
        currentLevel += 1;
        const bossCount = Excel.shuiguoguanqia(currentLevel + 1).levelboshuid.length;
        GameDataMgr.updateLevelWave(currentLevel, bossCount, 2);
        FruitDataManager.isNeedResetWareHouse = true;
        EventMgrInstance.emitEvent(EVENT_TYPE.HallResetUnLockFurit);
        EventMgrInstance.emitEvent(EVENT_TYPE.HallResetBag);
    }

    /**
     * 更新挑战逻辑处理
     */
    private handleChallengeUpdate(): void {
        const challengeBossCount = Excel.shuiguotiaozhan(1).levelboshuid.length;
        GameDataMgr.updateLevelWave(1, challengeBossCount, 1);
    }
}

export default ViewDebugItem;